package me.yobol.lintcode;

/**
 *
 * @author Yobol
 */
public class SortUtils {
    public static boolean isEquals(int[] a,int[] b){
        if (a == null || b == null) {
            return false;
        }
        
        if (a.length != b.length) {
            return false;
        }else{
            for (int i = 0; i < a.length; i++) {
                if (a[i] != b[i]) {
                    return false;
                }
            }
        }
        return true;
    }
    
    public static boolean isAscending(int[] a){
        if (a == null || a.length == 0) {
            return false;
        }
        for (int i = 1; i < a.length; i++) {
            if (a[i] < a[i - 1]) {
                return false;
            }
        }
        return true;
    }
    
    public static void swap(int[] array,int indexA,int indexB){
        int temp = array[indexA];
        array[indexA] = array[indexB];
        array[indexB] = temp;
    }
}
